package com.example.lte.repo;

import com.example.lte.entity.OperationLogEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author lzh
 * @date 2020/11/2 - 16:01
 */
@Repository
public interface OperationLogRepo extends JpaSpecificationExecutor<OperationLogEntity>, JpaRepository<OperationLogEntity,Long> {

    @Transactional
    @Modifying(clearAutomatically = true)
    @Query(nativeQuery = true,value = "delete from operation_log where account is null or account =''")
    void deleteByAccountIsNull();

}
